<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace='ShiftH' xmlns='http://ibatis.apache.org/mapping' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  <alias>
    <typeAlias alias='ShiftH' assembly='Janus.Mes.POCO.dll' type='Janus.Mes.POCO.ShiftH' />
  </alias>
  <resultMaps>
    <resultMap id='ShiftHResult' class='ShiftH'>
	<result property='Id' column='Id' /> 
	<result property='ShiftCode' column='ShiftCode' /> 
	<result property='WorkCCode' column='WorkCCode' /> 
	<result property='ShiftName' column='ShiftName' /> 
	<result property='ShiftNature' column='ShiftNature' /> 
	<result property='StartTime' column='StartTime' /> 
	<result property='EndTime' column='EndTime' /> 
	<result property='WorkTime' column='WorkTime' /> 
	<result property='NormalWorkTime' column='NormalWorkTime' /> 
	<result property='EffectWorkTime' column='EffectWorkTime' /> 
	<result property='RestTime' column='RestTime' /> 
	<result property='Remark' column='Remark' /> 
	<result property='Creator' column='Creator' /> 
	<result property='CreateDate' column='CreateDate' /> 
	<result property='Updater' column='Updater' /> 
	<result property='UpdateDate' column='UpdateDate' /> 
	<result property='IsDelete' column='IsDelete' /> 
	<result property='CreatorCode' column='CreatorCode' /> 
	<result property='UpdaterCode' column='UpdaterCode' /> 
	<result property='OperDept' column='OperDept' /> 
	<result property='Timestamp' column='Timestamp' /> 
		</resultMap>
  </resultMaps>  
  <statements>
  <sql id="UpdaterConditions">  
  <dynamic prepend="SET">
        	<isPropertyAvailable prepend="" property="WorkCCode">
        <isNotEmpty prepend="," property="WorkCCode">
		          [WorkCCode]=#WorkCCode#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="ShiftName">
        <isNotEmpty prepend="," property="ShiftName">
		          [ShiftName]=#ShiftName#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="ShiftNature">
        <isNotEmpty prepend="," property="ShiftNature">
		          [ShiftNature]=#ShiftNature#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="StartTime">
        <isNotEmpty prepend="," property="StartTime">
		          [StartTime]=#StartTime#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="EndTime">
        <isNotEmpty prepend="," property="EndTime">
		          [EndTime]=#EndTime#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="WorkTime">
        <isNotEmpty prepend="" property="WorkTime">
				  <isNotEqual prepend="," property="WorkTime" compareValue="0">
		          [WorkTime]=#WorkTime#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="NormalWorkTime">
        <isNotEmpty prepend="," property="NormalWorkTime">
		          [NormalWorkTime]=#NormalWorkTime#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="EffectWorkTime">
        <isNotEmpty prepend="," property="EffectWorkTime">
		          [EffectWorkTime]=#EffectWorkTime#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="RestTime">
        <isNotEmpty prepend="" property="RestTime">
				  <isNotEqual prepend="," property="RestTime" compareValue="0">
		          [RestTime]=#RestTime#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="Remark">
        <isNotEmpty prepend="," property="Remark">
		          [Remark]=#Remark#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="Creator">
        <isNotEmpty prepend="," property="Creator">
		          [Creator]=#Creator#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="" property="CreateDate">
				  <isNotEqual prepend="," property="CreateDate" compareValue="1900-01-01">
		          [CreateDate]=#CreateDate#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="Updater">
        <isNotEmpty prepend="," property="Updater">
		          [Updater]=#Updater#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="UpdateDate">
        <isNotEmpty prepend="" property="UpdateDate">
				  <isNotEqual prepend="," property="UpdateDate" compareValue="1900-01-01">
		          [UpdateDate]=#UpdateDate#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="IsDelete">
        <isNotEmpty prepend="" property="IsDelete">
				  <isNotEqual prepend="," property="IsDelete" compareValue="0">
		          [IsDelete]=#IsDelete#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="CreatorCode">
        <isNotEmpty prepend="," property="CreatorCode">
		          [CreatorCode]=#CreatorCode#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="UpdaterCode">
        <isNotEmpty prepend="," property="UpdaterCode">
		          [UpdaterCode]=#UpdaterCode#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="," property="OperDept">
		          [OperDept]=#OperDept#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	 </dynamic>
    </sql>
	<sql id="WhereConditions">
	 <dynamic prepend="WHERE">
	 	 <isPropertyAvailable prepend="" property="Id">
        <isNotEmpty prepend="AND" property="Id">
		          [Id]=#Id#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="ShiftCode">
        <isNotEmpty prepend="AND" property="ShiftCode">
		          [ShiftCode]=#ShiftCode#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="WorkCCode">
        <isNotEmpty prepend="AND" property="WorkCCode">
		          [WorkCCode]=#WorkCCode#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="ShiftName">
        <isNotEmpty prepend="AND" property="ShiftName">
		          [ShiftName]=#ShiftName#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="ShiftNature">
        <isNotEmpty prepend="AND" property="ShiftNature">
		          [ShiftNature]=#ShiftNature#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="StartTime">
        <isNotEmpty prepend="AND" property="StartTime">
		          [StartTime]=#StartTime#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="EndTime">
        <isNotEmpty prepend="AND" property="EndTime">
		          [EndTime]=#EndTime#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="WorkTime">
        <isNotEmpty prepend="" property="WorkTime">
				  <isNotEqual prepend="AND" property="WorkTime" compareValue="0">
		          [WorkTime]=#WorkTime#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="NormalWorkTime">
        <isNotEmpty prepend="AND" property="NormalWorkTime">
		          [NormalWorkTime]=#NormalWorkTime#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="EffectWorkTime">
        <isNotEmpty prepend="AND" property="EffectWorkTime">
		          [EffectWorkTime]=#EffectWorkTime#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="RestTime">
        <isNotEmpty prepend="" property="RestTime">
				  <isNotEqual prepend="AND" property="RestTime" compareValue="0">
		          [RestTime]=#RestTime#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="Remark">
        <isNotEmpty prepend="AND" property="Remark">
		          [Remark]=#Remark#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="Creator">
        <isNotEmpty prepend="AND" property="Creator">
		          [Creator]=#Creator#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="" property="CreateDate">
				  <isNotEqual prepend="AND" property="CreateDate" compareValue="1900-01-01">
		          [CreateDate]=#CreateDate#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="Updater">
        <isNotEmpty prepend="AND" property="Updater">
		          [Updater]=#Updater#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="UpdateDate">
        <isNotEmpty prepend="" property="UpdateDate">
				  <isNotEqual prepend="AND" property="UpdateDate" compareValue="1900-01-01">
		          [UpdateDate]=#UpdateDate#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="IsDelete">
        <isNotEmpty prepend="" property="IsDelete">
				  <isNotEqual prepend="AND" property="IsDelete" compareValue="0">
		          [IsDelete]=#IsDelete#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="CreatorCode">
        <isNotEmpty prepend="AND" property="CreatorCode">
		          [CreatorCode]=#CreatorCode#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="UpdaterCode">
        <isNotEmpty prepend="AND" property="UpdaterCode">
		          [UpdaterCode]=#UpdaterCode#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="AND" property="OperDept">
		          [OperDept]=#OperDept#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="Timestamp">
        <isNotEmpty prepend="" property="Timestamp">
				  <isNotEqual prepend="AND" property="Timestamp" compareValue="1900-01-01">
		          [Timestamp]=#Timestamp#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic> 
    </sql>
	<sql id="InsertPublic">
      INSERT INTO ShiftH(
	     <dynamic prepend=" ">
       	   <isPropertyAvailable prepend="" property="Id">
        <isNotEmpty prepend="," property="Id">
          [Id]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="ShiftCode">
        <isNotEmpty prepend="," property="ShiftCode">
          [ShiftCode]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="WorkCCode">
        <isNotEmpty prepend="," property="WorkCCode">
          [WorkCCode]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="ShiftName">
        <isNotEmpty prepend="," property="ShiftName">
          [ShiftName]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="ShiftNature">
        <isNotEmpty prepend="," property="ShiftNature">
          [ShiftNature]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="StartTime">
        <isNotEmpty prepend="," property="StartTime">
          [StartTime]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="EndTime">
        <isNotEmpty prepend="," property="EndTime">
          [EndTime]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="WorkTime">
        <isNotEmpty prepend="," property="WorkTime">
          [WorkTime]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="NormalWorkTime">
        <isNotEmpty prepend="," property="NormalWorkTime">
          [NormalWorkTime]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="EffectWorkTime">
        <isNotEmpty prepend="," property="EffectWorkTime">
          [EffectWorkTime]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="RestTime">
        <isNotEmpty prepend="," property="RestTime">
          [RestTime]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="Remark">
        <isNotEmpty prepend="," property="Remark">
          [Remark]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="Creator">
        <isNotEmpty prepend="," property="Creator">
          [Creator]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="," property="CreateDate">
          [CreateDate]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="Updater">
        <isNotEmpty prepend="," property="Updater">
          [Updater]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="UpdateDate">
        <isNotEmpty prepend="," property="UpdateDate">
          [UpdateDate]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="IsDelete">
        <isNotEmpty prepend="," property="IsDelete">
          [IsDelete]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="CreatorCode">
        <isNotEmpty prepend="," property="CreatorCode">
          [CreatorCode]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="UpdaterCode">
        <isNotEmpty prepend="," property="UpdaterCode">
          [UpdaterCode]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="," property="OperDept">
          [OperDept]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="Timestamp">
        <isNotEmpty prepend="," property="Timestamp">
          [Timestamp]
        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic>
      )
      VALUES
      (
	   <dynamic prepend=" ">
      	<isPropertyAvailable prepend="" property="Id">
        <isNotEmpty prepend="," property="Id">		
         #Id#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="ShiftCode">
        <isNotEmpty prepend="," property="ShiftCode">		
         #ShiftCode#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="WorkCCode">
        <isNotEmpty prepend="," property="WorkCCode">		
         #WorkCCode#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="ShiftName">
        <isNotEmpty prepend="," property="ShiftName">		
         #ShiftName#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="ShiftNature">
        <isNotEmpty prepend="," property="ShiftNature">		
         #ShiftNature#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="StartTime">
        <isNotEmpty prepend="," property="StartTime">		
         #StartTime#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="EndTime">
        <isNotEmpty prepend="," property="EndTime">		
         #EndTime#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="WorkTime">
        <isNotEmpty prepend="," property="WorkTime">		
         #WorkTime#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="NormalWorkTime">
        <isNotEmpty prepend="," property="NormalWorkTime">		
         #NormalWorkTime#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="EffectWorkTime">
        <isNotEmpty prepend="," property="EffectWorkTime">		
         #EffectWorkTime#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="RestTime">
        <isNotEmpty prepend="," property="RestTime">		
         #RestTime#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="Remark">
        <isNotEmpty prepend="," property="Remark">		
         #Remark#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="Creator">
        <isNotEmpty prepend="," property="Creator">		
         #Creator#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="," property="CreateDate">		
         #CreateDate#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="Updater">
        <isNotEmpty prepend="," property="Updater">		
         #Updater#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="UpdateDate">
        <isNotEmpty prepend="," property="UpdateDate">		
         #UpdateDate#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="IsDelete">
        <isNotEmpty prepend="," property="IsDelete">		
         #IsDelete#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="CreatorCode">
        <isNotEmpty prepend="," property="CreatorCode">		
         #CreatorCode#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="UpdaterCode">
        <isNotEmpty prepend="," property="UpdaterCode">		
         #UpdaterCode#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="," property="OperDept">		
         #OperDept#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="Timestamp">
        <isNotEmpty prepend="," property="Timestamp">		
         #Timestamp#		
        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic>
      )
    </sql>
	<!-- Insert statement:新增Mapper-->
    <insert id='Insert' parameterClass='ShiftH'>
      <include refid="InsertPublic"/>
    </insert>
    <!--Update statement:修改Mapper-->
    <update id='Update' parameterClass='ShiftH'>
      UPDATE [ShiftH] 
      <include refid="UpdaterConditions"/>
      WHERE 1=1
	  	  AND ShiftCode=#ShiftCode#
	      </update>
    <update id='UpdateSetion' parameterClass='hashtable'>
      UPDATE [ShiftH] 
      <include refid="UpdaterConditions"/>
      WHERE $conditions$
    </update>
	<update id='Save' parameterClass='ShiftH'>
      IF NOT EXISTS(SELECT 1 FROM [ShiftH] WHERE 1=1  AND [ShiftCode]=#ShiftCode# )
      BEGIN
      <include refid="InsertPublic"/>
      END
      ELSE
      BEGIN
      UPDATE ShiftH 
      <include refid="UpdaterConditions"/>
      WHERE  1=1
	  	  AND [ShiftCode]=#ShiftCode#
	        END
    </update>
	<delete id='Delete' parameterClass='hashtable'>
      DELETE FROM [ShiftH] WHERE	  
        <![CDATA[  
	 [ShiftCode]=#pk0# 
        ]]>
    </delete>
    <delete id='DeleteWhere' parameterClass='string'>
      DELETE FROM [ShiftH] WHERE $value$
    </delete>

    <!-- select by key statement:-->
    <select id='FindOne' parameterClass='hashtable' resultClass='ShiftH'>
      SELECT * FROM ShiftH WHERE      
        <![CDATA[
		[ShiftCode]=#pk0# 
        ]]>
    </select>
    <select id='FindAllCondition' parameterClass='string' resultClass='ShiftH'>
      SELECT * FROM [ShiftH] WHERE $value$
    </select>
    <select id='FindScalar' parameterClass='hashtable' resultClass='ShiftH'>
      SELECT * FROM [ShiftH] WHERE $conditions$
    </select>
    
    <select id='FindAllCount' parameterClass='string' resultClass='int'>
      SELECT COUNT(1) FROM [ShiftH] WHERE $value$
    </select>
    <select id='FindByPage' parameterClass='string' resultClass='ShiftH'>
      SELECT * FROM [ShiftH] WHERE $value$
    </select>
  </statements>
</sqlMap>
